﻿<phone:PhoneApplicationPage 
    x:Class="AdRotatorExample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:adRotator="clr-namespace:AdRotator;assembly=AdRotator"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,-10,0,28">
            <TextBlock x:Name="PageTitle" Text="ad rotator" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,-40,0,0">
        	<Grid.RowDefinitions>
        		<RowDefinition Height="0.147*"/>
        		<RowDefinition Height="0.853*"/>
        	</Grid.RowDefinitions>
            <!-- V0.9.1 COnfiguration abd below
            TODO: replace 
                        - SettingsUrl
                        - for PubCenter: PubCenterAdUnitId and PubCenterAppId
                        - for AdMob: AdMobAdUnitId
                        - for AdDuplex: AdDuplexAppId
                        - for InnerActive: InneractiveAppId
                        - for MobFox: MobFoxAppId
                        - for Smaato: SmaatoPublisherId and SmaatoAppId
                        with correct values.
            <adRotator:AdRotatorControl x:Name="AdRotatorControl" Width="480" Height="80"
                        DefaultSettingsFileUri="/AdRotatorExample;component/defaultAdSettings.xml"
                        SettingsUrl="http://mysite/defaultAdSettings.xml"
                        PubCenterAdUnitId="Image480_80"
                        PubCenterAppId="test_client"
                        AdDuplexAppId="2859"
                        AdMobAdUnitId="a14e5b8669ef367"
                        InneractiveAppId="DavideCleopadre_ClockAlarmNightLight_WP7" 
                        MobFoxAppId="1d59fb0a677336d8cd4cbd5c7c117f9d" MobFoxIsTest="False"
                        SmaatoPublisherId="923855310" SmaatoAppId="65754722"/> -->
            
            <!-- V1 Configuration
                        Ap Provider configuration values moved to configuration XML - see "defaultAdSettings"
                        Control still supports above configuration but these will hard code the app to these values-->
            <adRotator:AdRotatorControl x:Name="AdRotatorControl"
            	DefaultSettingsFileUri="/AdRotatorExample;component/defaultAdSettings.xml"
            	SettingsUrl="http://mysite/defaultAdSettings.xml" Margin="0,5" Visibility="Collapsed" SlidingAdDirection="None"/>
            <ScrollViewer Grid.Row="1">
            	<StackPanel Orientation="Vertical" Width="432">
            		<TextBlock TextWrapping="Wrap" Text="TODO: configure AdRotatorControl in XAML"/>
            		<Button Content="Next Random Ad" Click="Random_Button_Click"/>
            		<Button Content="Next Ad Provider" Click="Next_Button_Click"/>
            		<StackPanel Orientation="Horizontal">
            			<TextBlock Text="Sliding ad type: "/>
            			<ComboBox SelectedItem="{Binding SlidingAdDirection, ElementName=AdRotatorControl, Mode=TwoWay}" 
            				x:Name="SlidingAdDirectionSelector"/>
            		</StackPanel>
            		<StackPanel Orientation="Horizontal">
            			<TextBlock Text="Sliding ad display seconds: " VerticalAlignment="Center"/>
            			<TextBox Text="{Binding SlidingAdDisplaySeconds, ElementName=AdRotatorControl, Mode=TwoWay}" Width="100"/>
            		</StackPanel>
            		<StackPanel Orientation="Horizontal">
            			<TextBlock Text="Sliding ad hidden seconds: " VerticalAlignment="Center"/>
            			<TextBox Text="{Binding SlidingAdHiddenSeconds, ElementName=AdRotatorControl, Mode=TwoWay}" Width="100"/>
            		</StackPanel>                        
            		<Border BorderBrush="White" BorderThickness="1" Margin="0,0,12,0" Height="290">
            			<StackPanel Orientation="Vertical" Margin="-1">
            				<TextBlock FontWeight="Bold" Text="Log" />
            				<ListBox x:Name="MessagesListBox" Grid.Row="2" Height="150"/>
            			</StackPanel>
            		</Border>
            	</StackPanel>
            </ScrollViewer>
        </Grid> 
    </Grid>
 
</phone:PhoneApplicationPage>